package com.creator.pangu.biz.controller;

import com.creator.pangu.biz.entity.BizDemo;
import com.creator.pangu.biz.service.IBizDemoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ljj
 * @since 2023-06-13
 */
@RestController
@RequestMapping("/bizDemo")
public class BizDemoController {

    @Resource
    IBizDemoService bizDemoService;

    @GetMapping("list")
    @PreAuthorize("hasAuthority('biz:demo:read')")
    public List<BizDemo> test(){
        return bizDemoService.list();
    }

    @GetMapping("count")
    @PreAuthorize("hasAuthority('biz:demo:upload')")
    public Integer count(){
        return bizDemoService.list().size();
    }

}
